/**
 * 问卷定义
 *
 * @Author: 殷世杰
 * @Date: 2019/09/20
 */
import axios from '@/api/fetch';
import * as types from './types';
import SERVER from '@/api/server';

// 查询答案列表信息
export const getAnswerInfo = params => axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerManage/questionnaire/queryAnswer`, { params });

// 修改答案信息
export const editAnswerInfo = params => axios.put(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/updateAnswerGroupInfo`, params, { mark: types.SAVE });

// 根据ID删除答案及选项信息
export const delAnswerGroupAndAnswerById = id => axios.delete(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerManage/questionnaire/${id}/delAnswerGroupAndAnswerById`);

// 根据答案组ID查询选项
export const queryAnswersPagByIds = params => axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerCare/activityVisitResult/getActivityEntryVisitResultAnswer`, { params });

// 根据答案组ID查询选项
export const queryAnswersPagPageByIds = params => axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerManage/questionnaire/${params.id}/answerGroup/answersPag`, {});

// 根据选项ID进行删除
export const delAnswerById = id => axios.delete(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerManage/questionnaire/${id}/delAnswerById`);

// 修改新增答案信息
export const saveAnswerInfo = params => axios.post(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerManage/questionnaire/saveAnswerInfo`, params, { mark: types.SAVE });

// 查询答案信息编辑页面信息
export const getAnswerEditInfo = id => axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerManage/questionnaire/${id}/answerGroup`);

// 查询问卷列表信息
export const getQuestionnaireInfo = params => axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerCare/activityVisitResult/getActivityEntryVisitResultQuestionnaire`, { params });

// 新增问题
export const addQuestionnaire = params => axios.post(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/addQuestion`, params);

// 修改问题
export const editQuestionnaire = params => axios.put(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/updateQuestion`, params);

// 删除问题
export const delQuestionnaireInfo = params => axios.delete(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/deleteQuestionById`, { params });

// 修改问卷停用启用
export const questionnaireModifyIsValid = params => axios.put(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerManage/questionnaire/${params.id}/isValid`, params);

// 根据问卷ID查询其选项
export const queryQuestionPagById = params => axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerManage/questionnaire/${params.id}/Questionnaire/questionPag`, {});

// 根据问题ID进行删除
export const delQuestionById = id => axios.delete(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerManage/questionnaire/${id}/delQuestionById`);

// 修改新增问卷
export const saveQuestionnaire = params => axios.post(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerManage/questionnaire/saveQuestionnaire`, params, { mark: types.SAVE });

// 根据答案组ID获取选项字符串
export const getAnswerStringById = id => axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerManage/questionnaire/${id}/Questionnaire/getAnswerStringById`);

// 查询问卷信息编辑页面信息
export const getQuestionnaireEditInfo = id => axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerManage/questionnaire/${id}/Questionnaire`);

// 根据关爱类型获取问卷列表
export const queryQuestionnaireByType = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/queryQuestionnaireByType`, { params });

// 查询问卷列表信息
export const questionPag = params => axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerCare/activityVisitResult/getActivityEntryVisitResultQuestion`, { params });

// 查询问卷列表信息
export const getQuestionnaireInfos = params => axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerCare/activityVisitResult/getActivityEntryVisitResultQuestionnaires`, { params });

export const questionAndAnswer = params => axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customerCare/activityVisitResult/getActivityEntryVisitResultQuestionNew`, { params });